package com.ruitu.mall_98_2.mvp.model;

import com.ruitu.mall_98_2.dao.APIRetrofit;
import com.ruitu.mall_98_2.mvp.contract.LoginContract;
import com.ruitu.router_module.bean.User;
import com.ruitu.router_module.bean.api.BaseResult;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class LoginModel implements LoginContract.Model {
    @Override
    public Observable<BaseResult<User>> login(String phone, String pwd,String type,String code) {
        return APIRetrofit.getDefault().login(phone, pwd,type,code)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult<User>> quickLogin(String openId, String type) {
        return APIRetrofit.getDefault().quickLogin(openId, type)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}
